package com.fire.control.system.module.middleware.controller.web;

import java.util.UUID;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Pageable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.fire.control.system.module.middleware.service.IMiddleWareService;
import com.fire.control.system.standard.BusinessInterfaceStandard;
import com.fire.control.system.support.protocol.comman.ResponseProtocol;
import com.fire.control.system.support.protocol.middleware.MiddleWareRequestProtocol;

/**
 * @author liuxincheng
 * @ClassName: MiddleWareControl
 * @Description: TODO(中间件控制器)
 * @date 2017年6月21日 上午11:10:43
 */
@RestController
@RequestMapping(path="web/middleWareCtr")
public class MiddleWareControl implements BusinessInterfaceStandard<MiddleWareRequestProtocol, ResponseProtocol>{

	@Autowired
	private IMiddleWareService middleWareService;
	
	/**
	 * @author  liuxincheng
	 * @Title: getMiddleWareList
	 * @Description: TODO(获得中间件列表)
	 * @param @param requestProtocol
	 * @param @return    设定文件
	 * @return ResponseProtocol    返回类型
	 * @throws null
	 */
	@RequestMapping(path="getMiddleWareList",method=RequestMethod.POST)
	public ResponseProtocol getMiddleWareList(MiddleWareRequestProtocol requestProtocol){
		requestProtocol.setTaskuuid(UUID.randomUUID().toString());
		ResponseProtocol response = middleWareService.getMiddleWareList(requestProtocol);
		return response;
	}
	
	/**
	 * @author  liuxincheng
	 * @Title: getMiddleWareListByName
	 * @Description: TODO(根据名字查询中间件列表)
	 * @param @param requestProtocol
	 * @param @return    设定文件
	 * @return ResponseProtocol    返回类型
	 * @throws null
	 */
	@RequestMapping(path="getMiddleWareListByName",method=RequestMethod.POST)
	public ResponseProtocol getMiddleWareListByName(MiddleWareRequestProtocol requestProtocol){
		requestProtocol.setTaskuuid(UUID.randomUUID().toString());
		ResponseProtocol response = middleWareService.getMiddleWareList(requestProtocol);
		return response;
	}
	
	/**
	 * @author  liuxincheng
	 * @Title: addMiddleWare
	 * @Description: TODO(添加中间件)
	 * @param @param requestProtocol
	 * @param @return    设定文件
	 * @return ResponseProtocol    返回类型
	 * @throws null
	 */
	@RequestMapping(path="addMiddleWare",method=RequestMethod.POST)
	public ResponseProtocol addMiddleWare(MiddleWareRequestProtocol requestProtocol){
		requestProtocol.setTaskuuid(UUID.randomUUID().toString());
		ResponseProtocol response = middleWareService.addMiddleWare(requestProtocol);
		return response;
	}
	
	/**
	 * @author  liuxincheng
	 * @Title: deleteMiddleWare
	 * @Description: TODO(删除中间件)
	 * @param @param requestProtocol
	 * @param @return    设定文件
	 * @return ResponseProtocol    返回类型
	 * @throws null
	 */
	@RequestMapping(path="deleteMiddleWare",method=RequestMethod.POST)
	public ResponseProtocol deleteMiddleWare(MiddleWareRequestProtocol requestProtocol){
		requestProtocol.setTaskuuid(UUID.randomUUID().toString());
		ResponseProtocol response = middleWareService.deleteMiddleWare(requestProtocol);
		return response;
	}
	
	/**
	 * @author  liuxincheng
	 * @Title: updateMiddleWare
	 * @Description: TODO(修改中间件信息)
	 * @param @param requestProtocol
	 * @param @return    设定文件
	 * @return ResponseProtocol    返回类型
	 * @throws null
	 */
	@RequestMapping(path="updateMiddleWare",method=RequestMethod.POST)
	public ResponseProtocol updateMiddleWare(MiddleWareRequestProtocol requestProtocol){
		requestProtocol.setTaskuuid(UUID.randomUUID().toString());
		ResponseProtocol response = middleWareService.updateMiddleWare(requestProtocol);
		return response;
	}
	
	/**
	 * @author  liuxincheng
	 * @Title: switchMiddleWareStatus
	 * @Description: TODO(转换中间件状态)
	 * @param @param requestProtocol
	 * @param @return    设定文件
	 * @return ResponseProtocol    返回类型
	 * @throws null
	 */
	@RequestMapping(path="switchMiddleWareStatus",method=RequestMethod.POST)
	public ResponseProtocol switchMiddleWareStatus(MiddleWareRequestProtocol requestProtocol){
		requestProtocol.setTaskuuid(UUID.randomUUID().toString());
		ResponseProtocol response = middleWareService.updateMiddleWare(requestProtocol);
		return response;
	}
}





























